Skip to content

Render dark mode toggle in sidebar on all pages (dobon's review)#1763

Open
dobon wants to merge 5 commits intomoment:masterfrom
dobon:open-source-contribution
Open

Render dark mode toggle in sidebar on all pages (dobon's review)#1763
dobon wants to merge 5 commits intomoment:masterfrom
dobon:open-source-contribution

Conversation

@dobon
Copy link
Contributor

@dobon dobon commented Feb 18, 2026

@camoch23 I reviewed your code and it looks pretty good, but I noticed that there is already a "is page scrolled?" feature built into docsify: when you are on the cover page the body element does NOT have a 'sticky' class, and when you are in the docs the body does have a 'sticky' class active.

Because of this I was able to eliminate the IntersectionObserver (which is a cool API that I haven't used before, thanks for introducing it to me), and instead handle the fade-in/fade-out styling in CSS.

For full clarity, my commit duplicates the dark mode toggle so it appears in both the cover (when it exists) and on the sidebar, but the sidebar toggle is opacity:0.0 until body has the 'sticky' class applied (ie: when you have scrolled down past the cover page).

I didn't really want to open a new pull request, but I couldn't figure out how to submit my commit to your branch, so please forgive the duplication.

@dobon dobon changed the title Open source contribution Render dark mode toggle in sidebar on all pages (dobon's review) Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants